package com.geetour.columbus.customer.dao.impl;

import org.springframework.stereotype.Service;

import com.geetour.columbus.common.exceptions.DAOException;
import com.geetour.columbus.common.model.C.Account;
import com.geetour.columbus.core.ibatis.SqlMapClientDaoSupportEx;
import com.geetour.columbus.customer.dao.IAccountDAO;

/**
 * @author ChenKai
 * @since 2012-4-22 2:17
 */
@Service
public class AccountDAOImpl extends SqlMapClientDaoSupportEx implements IAccountDAO {
	
    @Override
    public Account findAccountById(Long id) throws DAOException {
        if (id == null) {
            return null;
        }
        return (Account) this.queryObject("findAccountById", id);
    }
    
    @Override
    public int insertAccount(Account account) throws DAOException {
        if (account == null) {
            return -1;
        }
        this.insert("insertAccount", account);
        return 1 ;
    }

    @Override
    public int updateAccount(Account account) throws DAOException {
        if (account == null || account.getId() == null) {
            return -1;
        }
        return this.update("updateAccount", account);
    }

}
